#include('../header.html',{active: 'publish', title:'发布文章'})
#include('./_header.html')
<div id="app" class="row" v-cloak>
    <loading :active.sync="isLoading" :can-cancel="true"></loading>
    <div class="col-lg-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">发布文章</h3>
            </div>
            <div class="panel-body">
                <input type="hidden" id="attach_url" value="${attachURL()}" />
                <form id="articleForm">
                    <input type="hidden" v-model="article.cid"/>
                    <input type="hidden" v-model="article.created"/>
                    <input type="hidden" v-model="article.status"/>
                    <input type="hidden" v-model="article.allowComment" />
                    <input type="hidden" v-model="article.allowPing" />
                    <input type="hidden" v-model="article.allowFeed" />
                    <input type="hidden" v-model="article.fmtType"/>
                    <input type="hidden" v-model="article.tags"/>

                    <div class="form-group col-md-6" style="padding: 0 10px 0 0;">
                        <input class="form-control" placeholder="请输入文章标题（必须）" v-model="article.title" required/>
                    </div>

                    <div class="form-group col-md-6" style="padding: 0 0 0 10px;">
                        <input class="form-control" placeholder="自定义访问路径，如：my-first-article  默认为文章id" v-model="article.slug"/>
                    </div>

                    <div class="form-group col-md-6" style="padding: 0 10px 0 0;">
                        <input id="tags" type="text" class="form-control" placeholder="请填写文章标签"/>
                    </div>

                    <div class="form-group col-md-6">
                        <v-select multiple v-model="article.selected" :options="categories"></v-select>
                    </div>

                    <div class="clearfix"></div>

                    <div class="form-group col-xs-12">
                        <div class="pull-right">
                            <button class="btn btn-purple btn-sm waves-effect waves-light switch-editor" @click="switchEditor">
                                切换为富文本编辑器
                            </button>
                        </div>
                    </div>

                    <div id="md-container" v-show="article.fmtType == 'markdown'" class="form-group col-md-12">
                        <textarea id="md-editor"></textarea>
                    </div>
                    <div id="html-container" v-show="article.fmtType == 'html'" class="form-group col-md-12">
                        <div class="summernote"></div>
                    </div>

                    <div class="form-group col-md-3 col-xs-4">
                        <label class="col-sm-4">开启评论</label>
                        <div class="col-sm-8">
                            <div id="allowComment" class="toggle toggle-success"></div>
                        </div>
                    </div>

                    <div class="form-group col-md-3 col-xs-4">
                        <label class="col-sm-4">允许Ping</label>
                        <div class="col-sm-8">
                            <div id="allowPing" class="toggle toggle-success"></div>
                        </div>
                    </div>

                    <div class="form-group col-md-3 col-xs-4">
                        <label class="col-sm-4">允许订阅</label>
                        <div class="col-sm-8">
                            <div id="allowFeed" class="toggle toggle-success"></div>
                        </div>
                    </div>

                    <div class="form-group col-md-3 col-xs-12">
                        <label class="col-sm-5">添加缩略图</label>
                        <div class="col-sm-7">
                            <div id="addThumb" class="toggle toggle-success"></div>
                        </div>
                    </div>

                    <div id="dropzone-container" class="form-group col-md-12 hide">
                        <div class="dropzone dropzone-previews" id="dropzone">
                            <div class="dz-message">
                                <p>可以为你的文章添加一张缩略图 ;)</p>
                            </div>
                        </div>
                        <input type="hidden" name="thumbImg" id="thumbImg"/>
                    </div>

                    <div class="clearfix"></div>

                    <div class="form-group col-md-6">
                        <div class="text-left">
                            <label class="col-sm-2 control-label" style="line-height: 30px;">发布时间</label>
                            <div class="col-sm-9 input-append date form_datetime">
                                <input v-model="article.createdTime" style="width: 150px;" size="16" type="text" readonly class="form-control" id="form_datetime">
                            </div>
                        </div>
                    </div>

                    <div class="form-group col-md-6">
                        <div class="text-right">
                            <a class="btn btn-default waves-effect waves-light" href="/admin/articles">返回列表</a>
                            <button type="button" class="btn btn-primary waves-effect waves-light" @click="publish('publish')">
                                发布文章
                            </button>
                            <button type="button" class="btn btn-warning waves-effect waves-light" @click="publish('draft')">
                                存为草稿
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
#include('./_footer.html')
<script src="/static/admin/js/new_article.js?v=${version}" ></script>
</body>
</html>